package com.fenghongzhang.kotlin5

import android.util.Log

fun main(){
//
//    val numbers = listOf("one", "two", "three", "four")
//
//    for (item in numbers){
//        println(item)
//    }
    val mutableListOf = mutableListOf("one", "two", "three")

    for(i in 0 until mutableListOf.size){
        println(mutableListOf[i])
    }

//    mutableListOf.add("four")
////    for (item in mutableListOf){
////        println(item)
////    }
//    mutableListOf.forEach{
//        println(it)
//    }

//    val numbers = setOf(1, 2, 3, 4)
//    val numbers = mutableSetOf(1, 2, 3, 4)
//    println("Number of elements: ${numbers.size}")
//    for (item in numbers){
//        println(item)
//    }
//
//    val numbersMap = mutableMapOf("key1" to 1, "key2" to 2, "key3" to 3, "key4" to 1)
//    numbersMap.put("key5",5)
//
//    numbersMap["key1"] = 11
//
//    println("All keys: ${numbersMap.keys}")
//    println("All values: ${numbersMap.values}")
//
//    if ("key2" in numbersMap) println("Value by key \"key2\": ${numbersMap["key2"]}")
//    if (1 in numbersMap.values) println("The value 1 is in the map")
//    if (numbersMap.containsValue(1)) println("The value 1 is in the map") // 同上


//    for (i in 1..4 step 2) print(i)

//    for (i in 4 downTo 1) print(i)
//
//    for (i in 1 until 10) {       // i in [1, 10), 10被排除
//        print(i)
//    }
}